#ifndef _PROTOCOL_EXAMPLE_HPP_20120421
#define _PROTOCOL_EXAMPLE_HPP_20120421

#include "base.hpp"

#include "protocol_value.hpp"
#include "protocol.hpp"
#include "streamer.hpp"

using namespace mina;

namespace protocol
{
    struct ProtocolExample : public Protocol
    {
        public :
            ProtocolExample() : Protocol(PROTOCOL_EXAMPLE, PROTOCOL_EXAMPLE)
            {
            }
    };

	struct ProtocolExampleReq : public Protocol
	{
		public :
			ProtocolExampleReq()
				: Protocol(PROTOCOL_EXAMPLE, PROTOCOL_EXAMPLE_REQ)
			{
			}

			virtual ~ProtocolExampleReq() {}

			void serialize(Streamer & streamer);
			
			virtual const std::string to_string() const;

			virtual uint32_t size() const
			{
				/*
				return (uint32_t)(Protocol::size() + sizeof(int8_t) * 2 +
							sizeof(int16_t) * 2 + sizeof(int32_t) * 2 +
							sizeof(int64_t) * 2 + sizeof(int32_t) + _string.size());
							*/
				return (uint32_t)(Protocol::size() + sizeof(uint16_t) + _name.size());
			}

		public :
			/*
			int8_t       _int8;
			uint8_t      _uint8;

			int16_t      _int16;
			uint16_t     _uint16;

			int32_t      _int32;
			uint32_t     _uint32;

			int64_t      _int64;
			uint64_t     _uint64;
			*/

			std::string  _name;
	};

	struct ProtocolExampleResp : public Protocol
	{
		public :
			ProtocolExampleResp()
				: Protocol(PROTOCOL_EXAMPLE, PROTOCOL_EXAMPLE_RESP)
			{
			}

			virtual ~ProtocolExampleResp() {}

			virtual const std::string to_string() const;

			void serialize(Streamer & streamer);

		public :
			int8_t       _int8;
			uint8_t      _uint8;

			int16_t      _int16;
			uint16_t     _uint16;

			int32_t      _int32;
			uint32_t     _uint32;

			int64_t      _int64;
			uint64_t     _uint64;

			std::string  _string;
	};

};

#endif

